# 引入 响应HTML模板
from django.shortcuts import render
#引入响应字符串函数
from django.http import HttpResponse
# 引入重定向
from django.shortcuts import redirect
# 引入数据模型
from gqb.models import Users

def index(request):
    return render(request, "张院国旗班.html")

def register(request):
    print(request.POST)
    username = request.POST.get('username')
    userpsd = request.POST.get('userpsd')
    if Users.objects.filter(username=username):
        return HttpResponse("此账号已注册")
    else:
        Users.objects.create(username=username,userpsd=userpsd)
        return HttpResponse("注册成功")
def login(request):
    username = request.GET.get('username')
    if Users.objects.filter(username=username):
        # 有数值 说明此账号存在
        return HttpResponse('此账号存在')
    else:
        return HttpResponse('此账号不存在')
